#include <time.h>
#include <cstdlib>
#include <windows.h>
#include <iostream>
#include "FSM/State.h"
#include "FSM/StateMachine.h"
#include "Entity/BaseEntity.h"
#include "Entity/EntityManager.h"
#include "Messaging/MessageDispatcher.h"

#include "Bunny.h"
#include "bunny_states.h"

#include "Wolf.h"
#include "wolf_states.h"

#include "MessageTypes.h"

using namespace std;




int main()
{
  //seed random number generator
  srand((unsigned) time(NULL));

  //create a miner
  Bunny* myBunny = new Bunny(id_bunny);
  EntityManager::Instance()->registerEntity(myBunny);

  Wolf* myWolf = new Wolf(id_wolf);
  EntityManager::Instance()->registerEntity(myWolf);
  /*
  //create his wife
  MinersWife* Elsa = new MinersWife(ent_Elsa);

  //register them with the entity manager
  EntityMgr->RegisterEntity(Bob);
  EntityMgr->RegisterEntity(Elsa);
  */

  //run Bob and Elsa through a few Update calls
  for (int i=0; i<30; ++i)
  {
	  myBunny->update();
	  myWolf->update();
	  cout << "Bunny Energy: " << myBunny->m_energy << endl;
	  cout << "Wolf Energy: " << myWolf->m_energy << endl;

	  MessageDispatcher::Instance()->dispatchDelayedMessages();

		Sleep(800);
  }

  /*
  //tidy up
  delete Bob;
  delete Elsa;

  //wait for a keypress before exiting
  PressAnyKeyToContinue();
  */

  int i;
  cin>>i;

  return 0;
}